package com.zc.angelica.controller;

import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.entity.RoleMenuInfo;
import com.zc.angelica.service.RoleMenuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/roleMenuInfo")
public class RoleMenuInfoController {

    @Autowired
    private RoleMenuInfoService roleMenuInfoService;

    @PostMapping("/bindMenu")
//    @PreAuthorize("hasPermission('addMenu','add')")
    public ResponseData bindMenu(@RequestBody RoleMenuInfo roleMenuInfo) {
        return roleMenuInfoService.bindMenu(roleMenuInfo);
    }

    @GetMapping("/unboundMenu")
    public ResponseData unboundMenu(Long roleId, Long menuId) {
        return roleMenuInfoService.unboundMenu(roleId, menuId);
    }

    @GetMapping("/getAllMenu")
    public ResponseData getAllMenu() {
        return roleMenuInfoService.getAllMenu();
    }


}
